package com.zjw.spring.aop;


/**
 * static proxy for DefaultCalculatorImpl,add log
 * @author zjw
 *
 */
public class StaticProxy4Calculator  implements ICalculator{
	private ICalculator target;// target
	
	public StaticProxy4Calculator() {
		target = new CalculatorImpl();
	}

	@Override
	public int add(int i, int j) {
		String methodName = "add";

		LogUtil.logBegin(methodName, i,j);
		int r = target.add(i, j);
		LogUtil.logEnd(methodName, r);
		return r;
	}

	@Override
	public int minus(int i, int j) {
		String methodName = "minus";

		LogUtil.logBegin(methodName, i,j);
		int r = target.minus(i, j);
		LogUtil.logEnd(methodName, r);
		return r;
	}

	@Override
	public int multiply(int i, int j) {
		String methodName = "multiply";

		LogUtil.logBegin(methodName, i,j);
		int r = target.multiply(i, j);
		LogUtil.logEnd(methodName, r);
		return r;
	}

	@Override
	public int divide(int i, int j) {
		String methodName = "divide";

		LogUtil.logBegin(methodName, i,j);
		int r = target.divide(i, j);
		LogUtil.logEnd(methodName, r);
		return r;
	}

}
